package com.qn.visitor.service;

import com.qn.common.base.BaseServiceImpl;
import com.qn.visitor.entity.FeatureBlacklist;
import com.qn.visitor.intercept.InterceptContext;
import com.qn.visitor.model.bo.intercept.InterceptResult;
import com.qn.visitor.model.bo.intercept.InterceptRule;
import com.qn.visitor.model.bo.intercept.InterceptSource;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * qingniu-cloud user source analysis
 *
 * @Author: TXG
 * @Date: 2024/6/11
 * @Version V0.0.2
 */
@DubboService(version = "1.0.0")
public class InterceptServiceImpl extends BaseServiceImpl<FeatureBlacklist> implements InterceptService {
    @Autowired
    InterceptContext context;
    @Autowired
    FeatureBlacklistService featureBlacklistService;

    
    @Override
    public InterceptResult intercept(InterceptSource source) {
        //获取规则
        InterceptRule rule = featureBlacklistService.getBlackRule();
        //执行黑白名单判断
        return context.intercept(source, rule);
    }
}